package com.dinggou.shopjb.view;


import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;

import com.dinggou.shopjb.R;
import com.dinggou.shopjb.application.MyApplication;
import com.dinggou.shopjb.base.BaseActivity;
import com.dinggou.shopjb.core.AppAction;
import com.dinggou.shopjb.utils.RouteUtil;


public class ToSetPayPassDialog extends MyDialog implements View.OnClickListener {

    private View rootView;
    private Button tv_cancel;
    private Button tv_confirm;
    protected AppAction mAppAction;
    private Context mContext;


    public ToSetPayPassDialog(Context context) {
        this(context, false, Gravity.CENTER);
    }

    public ToSetPayPassDialog(Context context, boolean isCancelAble, int gravity) {
        super(context, isCancelAble, gravity);
        mContext = context;
        mAppAction = MyApplication.getApplication().getAppAction();
        rootView = LayoutInflater.from(context).inflate(R.layout.dialog_to_set_pay_pass, null);
        setContentView(rootView);

        tv_cancel = rootView.findViewById(R.id.tv_cancel);
        tv_confirm = rootView.findViewById(R.id.tv_confirm);

        tv_cancel.setOnClickListener(this);
        tv_confirm.setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {
        Bundle bundle;
        switch (v.getId()) {
            case R.id.tv_cancel:
                dismiss();
                break;
            case R.id.tv_confirm:
                dismiss();
                RouteUtil.tosetPayPwdActivity((BaseActivity) mContext);
                break;
        }
    }


    public void gotoActivity(Context mContext, Class<?> toActivityClass, Bundle bundle) {
        Intent intent = new Intent(mContext, toActivityClass);
        if (bundle != null) {
            intent.putExtras(bundle);
        }
        mContext.startActivity(intent);
        ((Activity) mContext).overridePendingTransition(R.anim.push_right_in, R.anim.not_exit_push_left_out);
    }



    public interface PrivateConfirmListener {
        void onCancelListener();
        void onConfirmListener();
    }
}
